LOTTERY_BET_USER_ANALYSIS_CONFIG = {
    'real_time_report': False,
    'group_by': '_user_id',
    'interval_type_list': ['day'],
    'target_event_id': ['cp_lottery'],
    'values': [
        {
            "value_id": "bet_order",
            "target_value": "_user_id",
            "value_name": "投注次数",
            "filter": [],
            "value_type": "long",
            "operation": "value_count"
        },
        {
            "value_id": "bet_amount",
            "target_value": "cp_lottery_price",
            "value_name": "投注金额",
            "filter": [],
            "not_filter": [
                {'range': {'cp_lottery_refund': {'gt': 0}}}
            ],
            "value_type": "float",
            "adjust_amount": True
        },
        {
            "value_id": "award_amount",
            "target_value": ['cp_lottery_win', '+', 'cp_lottery_bonus'],
            "value_name": "中奖金额",
            "filter": [
                {"term": {"cp_lottery_refund": 0}}
            ],
            "value_type": "float",
            "adjust_amount": True
        },
        {
            "value_id": "choushui",
            "target_value": ['cp_lottery_win', '+', 'cp_lottery_bonus', '-', 'cp_lottery_price'],
            "value_name": "玩法盈亏",
            "filter": [],
            "value_type": "float",
            "adjust_amount": True
        },
        {
            "value_id": "choushui_rate",
            "value_name": "抽水率",
            "value_expr": "(choushui/bet_amount) * -1",
            "is_percentage": True,
            "fmt": lambda v: float("%.2f" % (v * 100))
        },
    ]
}
